package day10;

/**
 * @author oldliu
 * @since 1.0
 */
public class Thread3 extends Thread {

    public Thread3(String n) {
        super(n);
    }

    public void run() {
        for (int i = 1; i <= 20; i++) {
            System.out.println(this.getName() + " 打印了 " + i);
        }
    }

    public static void main(String[] args) {
        for (int i = 1; i <= 20; i++) {
            //子线程4个+1个main
            Thread th=new Thread3("线程 " + i);
            if(i%3==0)
                th.setPriority(Thread.MAX_PRIORITY);
            else if(i%3==1)
                th.setPriority(Thread.NORM_PRIORITY );
            else
                th.setPriority(Thread.MIN_PRIORITY);

            th.start();
        }
    }
}
